package com.huang;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class ProApp {
    public static void main(String[] args) {
        SpringApplication.run(ProApp.class,args);
    }
    @RestController
    public class Provider{
        @Value("${server.port}")
        private String server;


        //获取远程配置中心的配置时，：后边的是默认配置，当配置中心服务停了就使用它
        @Value("${server.tomcats.threads.max:200}")
        private  String maxtom;

        @Value("${logging.level.com.huang:debug}")
        private  String level;
        @GetMapping("/echo/{msg}")
        public String echo(@PathVariable String msg){
            return server+"欢迎"+msg;
        }

        //基于feign的方法的实现
        @GetMapping("/echo2/{msg}")
        public String echo2(@PathVariable  String msg) throws InterruptedException {
            Thread.sleep(5222222);
            return "调用openFeign的方式成功"+msg;
        }

    @GetMapping("/peizhi")
        public String peizhi(){

            return "日志的级别是："+level+"----"+"配置中心的最大tomcat的数量是："+maxtom;
        }

    }


}
